<?php
if($_SESSION['is_logged']!=true)
{
    header('Location: ../index.php');
    exit;
}
if(isset($_GET['logout']))
{
    session_destroy();
    header('Location: ../index.php');
    exit;
}
include 'includes'.DIRECTORY_SEPARATOR.'functions.php';
db() ;

$header_information_q = mysql_query('SELECT rep,power,money,smart,life,referal FROM users WHERE user="'.$_SESSION['user_info']['user'].'"');
$header_information = mysql_fetch_assoc($header_information_q);

$rep = $header_information['rep'];
$power = $header_information['power'];
$money = $header_information['money'];
$smart = $header_information['smart'];
$life = $header_information['life'];
$referal = $header_information['referal'];
$lev = ($rep+$power)/4;
$level = (int)$lev;

include 'includes'.DIRECTORY_SEPARATOR.'level.php';
include 'includes'.DIRECTORY_SEPARATOR.'rep.php';
    


$casino_q = mysql_query('SELECT * FROM casino ORDER BY date DESC'); 
$avatar_q = mysql_query('SELECT avatar FROM users WHERE user="'.$_SESSION['user_info']['user'].'"');
$avatar = mysql_fetch_assoc($avatar_q);
mysql_query('update users set power=power+5,resp=resp+10,training=0 where '.time().'-training>=10800 and training!=0 ') ;